<template>
    <el-card @click="goDetail" class="container_card" shadow="hover">
        <div class="content">
            <div class="left">
                <div class="left_hospital">
                    {{ hospitalInfo.hosname }}
                </div>
                <div class="left_tip">
                    <div class="level">
                        <el-icon>
                            <Ship />
                        </el-icon>
                        <div>{{ hospitalInfo.param.hostypeString }}</div>
                    </div>
                    <div class="level">
                        <el-icon>
                            <AlarmClock />
                        </el-icon>
                        <div>每天 <span>{{ hospitalInfo.bookingRule.releaseTime }}</span> 放号</div>
                    </div>
                </div>
            </div>
            <div class="right">
                <img :src="'data:image/jpeg;base64,' + hospitalInfo.logoData" :alt="hospitalInfo.hosname">
            </div>
        </div>
    </el-card>
</template>
<script setup lang="ts">
import { useRouter } from 'vue-router';
import { Ship, AlarmClock } from '@element-plus/icons-vue';
// 接收父组件传递过来的props -> 即为已有的医院的数据
let props = defineProps(['hospitalInfo'])
// 创建路由器对象
let $router = useRouter()

// 点击医院卡片的时候跳转到医院详情页面
const goDetail = () => {
    $router.push({
        path: '/hospital/register',
        query: { hoscode: props.hospitalInfo.hoscode }
    })
}
</script>
<style scoped lang="scss">
.container_card {
    cursor: pointer;

    .content {
        display: flex;
        justify-content: space-between;

        .right {
            display: flex;
            justify-content: center;
            align-items: center;

            img {
                width: 80px;
                height: 80px;
                object-fit: cover;
            }
        }

        .left {
            width: 100%;
            margin-right: 16px;

            .left_hospital {
                font-weight: 700;
            }

            .left_tip {
                margin-top: 16px;
                display: flex;
                justify-content: space-between;
                align-items: center;

                .level {
                    display: flex;
                    align-items: center;

                    div {
                        margin-left: 6px;

                        span {
                            font-weight: 700;
                            color: lightcoral;
                        }
                    }
                }
            }
        }

    }
}

@media (max-width:768px) {
    .container_card {
        .content {
            .right {
                img {
                    width: 60px !important;
                    height: 60px !important;
                }
            }

            .left_tip {
                font-size: 12px;
            }
        }
    }
}
</style>